﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Joyintech.Common;
using Joyintech.Model.inpiao365;
using Ajax;
using Joyintech.BLL.inpiao365;

namespace Joyintech.Admin.inpiao365.general
{
    public partial class _index : System.Web.UI.Page
    {
        /// <summary>
        /// 默认显示菜单Id
        /// </summary>
        public string menuId = "01";

        protected void Page_Load(object sender, EventArgs e)
        {
            Ajax.Utility.RegisterTypeForAjax(typeof(_index));

            if (!this.IsPostBack)
            {
                //读取系统界面配置相关
                if (systemUser_BLL.GetInstance().GetObject("Interface") == null)
                {
                    systemUser_BLL.GetInstance().StoreObject("Interface", new systemInterface_BLL().GetModel(1));
                }

                this.Page.Title = ((systemInterface)systemUser_BLL.GetInstance().GetObject("Interface")).IeTitle;

                if (DNTRequest.GetQueryString("theme") != null && PageValidate.IsNumber(DNTRequest.GetQueryString("theme")))
                {
                    Utils.WriteCookie("userTheme", DNTRequest.GetQueryString("theme").ToString(), DateTime.Now.AddDays(15));
                }
            }
        }

        /// <summary>
        /// Ajax方法，记录用户退出日志
        /// </summary>
        /// <returns></returns>
        [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
        public void UserLogout()
        {
            try
            {
                Global.WriteLog("用户退出", "用户退出", systemUser_BLL.GetInstance().GetCurrentSystemUser().UserTrueName.ToString(), systemUser_BLL.GetInstance().GetCurrentSystemUser().UserName.ToString());
            }
            catch
            { }
            finally
            {
                //HttpContext.Current.Session.Clear();
            }
        }


    }
}